﻿@model EraNet.Core.Model.Account.Employee
@{
    Layout = null;
}

<script type="text/javascript" src="@Url.Content("~/Scripts/fancyapps-fancyBox-18d1712/source/jquery.fancybox.js?v=2.1.5")"></script>
<link rel="stylesheet" type="text/css" href="@Url.Content("~/Scripts/fancyapps-fancyBox-18d1712/source/jquery.fancybox.css?v=2.1.5")" media="screen" />

<script type="text/javascript">
    function submitform() {

        var oldPwdVal = $("#oldPwd").val();
        var newPwdVal = $("#newPwd").val();
        var ConfigNewPwdVal = $("#ConfigNewPwd").val();

        var data = "&oldPwd=" + oldPwdVal + "&newPwd=" + newPwdVal + "&ConfigNewPwd=" + ConfigNewPwdVal;
        $.ajax({
            async: false,
            type: "POST",
            url: "/IMS/Common/setPassword",
            dataType: "json",
            data: data,
            success: function (data) {
                switch (data) {
                    case "1": alert("原密码不能为空！");
                        break;
                    case "2": alert("新密码不能为空！");
                        break;
                    case "3": alert("确认密码不能为空！");
                        break;
                    case "4": alert("原密码输入错误！");
                        break;
                    case "5": alert("新密码跟确认密码不一致！");
                        break;
                    case "6": alert("更新成功！"); $.fancybox.close('#updPwd');
                        break;
                    default: alert("更新失败!");
                        break;
                }

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert('请求出现异常，请稍后再试');
            }

        });
    }

    $(function () {
        //分数设定
        $("#btnSetScore").click(function () {
            //获取文本框中输入的值
            var score = $("#txtMyScore").val();
            if (!isNaN(score)&&(parseInt(score)>=0&&parseInt(score)<=100)) {
                $.ajax({
                    url: "/IMS/Common/setScore",
                    type: "post",
                    data: { score: score },
                    success: function (data) {
                        if (data == "1") {
                            alert("设置成功");
                            $.fancybox.close('#setScore');
                        } else {
                            alert("设置失败，请稍后再试！");
                            $.fancybox.close('#setScore');
                        }
                    },
                    error: function () {
                        alert('请求出现异常，请稍后再试');
                        $.fancybox.close('#setScore');
                    }
                });
            } else {
                alert("请输入数字0到100之间的数字");
            }

        });
    });
</script>
<div id="topnav">
    @*<a href="#">
<img class="avatar" src="/styles/img/user_32.png" alt="" /></a>*@ 用户名：<b>@Model.AccountName</b>
    <span>|</span> <a class="fancybox" href="#updPwd">修改密码</a> <span>|</span> <a href="/IMS/Common/LogOffMember">
        退出</a><br />
</div>
<div id="updPwd" style="display: none">
    <table style="height: 100px; width: 300px" border="0">
        <tr>
            <td>
                原密码：
            </td>
            <td>
                <input type="password" id="oldPwd" name="oldPwd" />
            </td>
        </tr>
        <tr>
            <td>
                新密码：
            </td>
            <td>
                <input type="password" id="newPwd" name="newPwd" />
            </td>
        </tr>
        <tr>
            <td>
                确认密码：
            </td>
            <td>
                <input type="password" id="ConfigNewPwd" name="ConfigNewPwd" />
            </td>
        </tr>
        <tr>
            <td>
                <input type="submit" id="btnSubmit" value="提交" onclick="submitform()" name="btnSubmit" />
            </td>
        </tr>
    </table>
</div>
<div id="setScore" style="display: none">
    <table style="height: 100px; width: 300px" border="0">
        <tr>
            <td>
                分数：
            </td>
            <td>
                <input type="text" id="txtMyScore" />
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" id="btnSetScore" value="提交" />
            </td>
        </tr>
    </table>
</div>
